﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Omega.Editor.Classes
{
    public static class ConfiguracoesGerais
    {
        static string root = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "Omega";

        public enum OmegaDirectory
        {
            Icons,
            DefaultProjectPath,
            Plugins
        }
        static public class Directory
        {
            static public bool CreateDyrectory(OmegaDirectory DirectoryToCreate)
            {
                if (DirectoryToCreate == OmegaDirectory.DefaultProjectPath)
                {
                    Directory.CreateDyrectory(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) +
                        "Omega\\Projetos");
                }

                if (System.IO.Directory.Exists(root + "\\" + DirectoryToCreate.ToString()))
                    return true;

                try
                {
                    System.IO.Directory.CreateDirectory(root + "\\" + DirectoryToCreate.ToString());
                    return true;
                }
                catch
                {
                    return false;
                }
            }
            static public bool CreateDyrectory(string directory)
            {
                if (System.IO.Directory.Exists(directory))
                    return true;

                try
                {
                    System.IO.Directory.CreateDirectory(directory);
                    return true;
                }
                catch
                {
                    return false;
                }
            }
            static public bool CreateDyrectory(string directory, bool useRoot)
            {
                if (System.IO.Directory.Exists(root + "\\" + directory))
                    return true;

                try
                {
                    System.IO.Directory.CreateDirectory(root + "\\" + directory);
                    return true;
                }
                catch
                {
                    return false;
                }
            }
        }

        static public class Ler
        {
            public static int Linguagem()
            {
                return Registro.Ler("Config\\", "SelectedLang", 0);
            }

        }

        static public class Gravar
        {
            static public bool Linguagem(int Lang)
            {
                try
                {
                    Registro.Gravar("Config\\", "SelectedLang", Lang);
                    return true;
                }
                catch
                {
                    return false;
                }

            }

        }
    }
}
